package vg.interfaces.ll_services.data_base_service;

import vg.interfaces.ll_services.data_base_service.data.graph.Attribute;
import vg.interfaces.ll_services.data_base_service.data.graph.Edge;
import vg.interfaces.ll_services.data_base_service.data.graph.Graph;
import vg.interfaces.ll_services.data_base_service.data.graph.Vertex;
import vg.interfaces.ll_services.data_base_service.data.header.*;

import java.util.List;

/**
 * Interface for graph data base.
 *
 * @author Timur Zolotuhin (e-mail: tzolotuhin@gmail.com)
 */
public interface IGraphDataBaseService {
	/**
	 * Creates header for the graph model and returns the unique id.
     *
	 * @param name - name of the graph.
	 */
	public int createGraphModelHeader(String name);

	/**
	 * Creates header for the graph and returns the unique id.
     *
	 * @param graphModelId - id of graph model, which will contains the graph. 
	 * @param directed - true - if the graph is directed, otherwise false.
     * @param root - true - if the graph is root, otherwise false.
	 */
	public int createGraphHeader(int graphModelId, boolean directed, boolean root);
	
	/**
	 * Creates header for the vertex and returns the unique id.
     *
	 * @param graphId - id of graph, which will contains the vertex.
	 * @param innerGraphId - link to inner graph, which is in this vertex.
	 */
	public int createVertexHeader(int graphId, int innerGraphId);

	/**
	 * Creates header for the edge and returns the unique id.
     *
	 * @param graphId - id of graph, which will contain the edge.
	 * @param sourceVertexId - id of source vertex.
	 * @param targetVertexId - id of target vertex.
	 */
	public int createEdgeHeader(int graphId, int sourceVertexId, int targetVertexId);
	
	/**
	 * Creates header for the attribute and returns the unique id.
     *
	 * @param edgeId - id of edge, which will contain the attribute.
     * @param name - attribute name.
     * @param value - string attribute value.
     * @param type - type of value. See AttributeHeader types: STRING_ATTRIBUTE_TYPE, INTEGER_ATTRIBUTE_TYPE, etc.
	 */
	public int createEdgeAttributeHeader(int edgeId, String name, String value, int type);
	
	/**
	 * Creates header for the attribute and returns the unique id.
     *
	 * @param vertexId - id of vertex, which will contain the attribute.
     * @param name - attribute name.
     * @param value - string attribute value.
     * @param type - type of value. See AttributeHeader types: STRING_ATTRIBUTE_TYPE, INTEGER_ATTRIBUTE_TYPE, etc.
     */
	public int createVertexAttributeHeader(int vertexId, String name, String value, int type);

    /**
     * Creates header for the attribute and returns the unique id.
     *
     * @param graphId - id of graph, which will contain the attribute.
     * @param name - attribute name.
     * @param value - string attribute value.
     * @param type - type of value. See AttributeHeader types: STRING_ATTRIBUTE_TYPE, INTEGER_ATTRIBUTE_TYPE, etc.
     */
    public int createGraphAttributeHeader(int graphId, String name, String value, int type);

    /**
     * Returns list of graph model headers.
     *
     * @param count - count of the headers, if count equals -1, that it returns all headers.
     */
    public List<GraphModelHeader> getGraphModelHeaders(int count);

    public VertexHeader getVertexHeader(int vertexId);

    public List<VertexHeader> getVertexHeadersByGraphId(int graphId, int count);

    public EdgeHeader getEdgeHeader(int edgeId);

    public List<EdgeHeader> getEdgeHeadersByGraphId(int graphId, int count);

    public GraphHeader getGraphHeader(int graphId);

    public List<GraphHeader> getRootGraphHeadersByGraphModelId(int graphModelId);

    public GraphModelHeader getGraphModelHeader(int graphModelId);

    public AttributeHeader getAttributeHeader(int attributeId);

    public List<AttributeHeader> getAttributeHeadersByOwner(int ownerId, int ownerType);

    public Vertex getVertex(int vertexId);

	public Edge getEdge(int edgeId);

    public Graph getGraph(int graphId);

    public Attribute getAttribute(int attributeId);

//    public Set<GraphHeader> getRootGraphHeaders();
//
//    public Set<VertexHeader> getVertexHeadersByGraphId(int graphId);
//
//    public Set<EdgeHeader> getEdgeHeadersByGraphId(int graphId);

//    /**
//     * Modifies existing graph model header.
//     */
//    public boolean modifyGraphModelHeader(GraphModelHeader newGraphModelHeader);
//
    public void modifyVertexHeader(VertexHeader newVertexHeader);
//
//    /**
//     * Modifies existing attribute header.
//     */
//    public boolean modifyAttributeHeader(AttributeHeader newAttributeHeader);
//
//    /**
//	 * Builds subgraph from input vertex indices and returns it.
//	 */
//	public Graph getSubGraph(List<Integer> vertexIds);
//
//	/**
//	 * This method returns graph by id.
//	 */
//	public Graph getGraph(int graphId);
//
//	/**
//	 * Returns some root graph by graph model id.
//	 */
//	public Graph getSomeRootGraphByGraphModelId(int graphModelId);
//
//    /**
//     * Returns collection, which contains all root graph id fir the graph model.
//     */
//    public Set<Integer> getAllRootGraphIds(int graphModelId);
//
//	public Edge getEdge(int edgeId);
//
//	public Vertex getVertex(int vertexId);
//
//	public Attribute getAttribute(int attrId);
//
//	public GraphModelHeader getGraphModelHeader(int graphModelId);
//
//    public GraphHeader getGraphHeader(int graphId);
//
//    public VertexHeader getVertexHeader(int vertexId);
//
//    public EdgeHeader getEdgeHeader(int edgeId);
//
//    public AttributeHeader getAttributeHeader(int attributeId);
//
//    public VertexHeader getVertexHeaderByGraphId(int graphId);

	/**
	 * Closes data base.
	 */
	public void close();
}
